#include "DataSystem.h"

bool DataSystem::Initialized(){
        initialized = true;
        BUFFER = new stringstream();
        OUT_BUFFER = new stringstream();
        return initialized;//need to change to return a static hasInit bool
}
bool DataSystem::readFile(string fileName){
        BUFFER->str("");
        ifstream inFile(fileName, std::ios::in);
        if(inFile.is_open()){

        *BUFFER << inFile.rdbuf();
        inFile.close();
                return true;
        }
        return false;
}
bool DataSystem::writeFile(string fileName, string fileData){
        
        ofstream outFile(fileName, std::ios::out);
        if(outFile.is_open()){

                outFile << fileData;
                outFile.close();
                return true;
        }
        else cout << ERROR_WRITE_FILE << fileName  << "\n";//appropriate error message inc filename
        return false;
}
void DataSystem::clearOutBuffer(){
        OUT_BUFFER->str("");
        OUT_BUFFER->clear();
}
void DataSystem::clearInBuffer(){
        BUFFER->str("");
}
void DataSystem::clearDataBuffers(){
        BUFFER->str("");
        BUFFER->clear();
        OUT_BUFFER->str("");
        OUT_BUFFER->clear();
}